package com.silence.ByteDance;

import sun.awt.image.ImageWatched;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.stream.Collectors;

abstract class Father {
    public final void f() {
        System.out.println("f");
    }

    public void s() {
    }

}

class Son extends Father {
    @Override
    public void s() {
        System.out.println("s");
    }

    public class book {
        String book = "Computer";
    }
}

class Daughter extends Father {

    @Override
    public void s() {
        System.out.println("d");
    }
}

enum ee {
    status1(1, "1"),
    status2(2, "2"),
    status3(3, "3"),
    status4(4, "4");
    private final int a;
    private final String b;

    ee(int aa, String bb) {
        this.a = aa;
        this.b = bb;
    }

    public boolean equalsStatus(Integer a) {
        return getA() == a;
    }

    public int getA() {
        return a;
    }

    public String getB() {
        return b;
    }
}

public class test_one {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        /*System.out.println(new Son().new book().book);
        Father son = new Son() {
            @Override
            public void s() {
                System.out.println("ss");
            }
        };
        son.s();
        System.out.println(ee.status1.equalsStatus(1));

        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("123");
        stringBuffer.append(1234567890987654321L);
        System.out.println(stringBuffer.toString());
        String stringJoiner = new StringJoiner("").add("123").add("1234567890987654321").toString();

        double a = 0.1;
        double b = 0.2;
        System.out.println(a+b);
        BigDecimal a1 = BigDecimal.valueOf(a);
        BigDecimal b1 = new BigDecimal(Double.toString(b));
        BigDecimal c1 = a1.add(b1);
        System.out.println(c1);
        BigDecimal c2 = a1.divide(b1,28,BigDecimal.ROUND_HALF_UP);
        System.out.println(c2);*/

        /*LocalDateTime time = LocalDateTime.of(LocalDate.now().minusDays(11).minusYears(10), LocalTime.now());
        System.out.println(time.format(DateTimeFormatter.ofPattern("yyyy--MM--dd HH::mm::ss")));*/

        /*Integer[] a = {3,1,2};
        Arrays.sort(a,(o1,o2) -> Integer.compare(o2,o1));
        for (int i : a) {
            System.out.println(i);
        }*/

       /*List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        Iterator<Integer> iterator = list.iterator();
        System.out.println(iterator.hasNext());
        System.out.println(iterator.next());
        list.forEach(System.out::print);*/

        /*LinkedList<Integer> list = new LinkedList<>();
        list.push(3);
        list.push(1);
        list.push(6);
        list.push(-9);
        list.pop();
        System.out.println(list);
        list.sort(((o1, o2) -> o2 - o1));
        Iterator<Integer> iterator = list.iterator();
        while (iterator.hasNext()){
            iterator.next();
            iterator.remove();
        }
        System.out.println(list);
        sss("hello",1,23,34,5,6,8,213,5,6);*/

        /*LinkedList<Integer> list = new LinkedList<>();
        list.push(3);
        list.push(1);
        list.push(6);
        list.push(-9);
        Set<Integer> set = new TreeSet<>();
        set.add(100);
        set.add(200);
        set.add(50);
        list.addAll(set);
        System.out.println(list);*/

        /*Map<String, Integer> map = new HashMap<>();
        map.put("a", 1);
        map.put("b", 2);
        map.put("c", 3);
        for (Map.Entry<String, Integer> stringIntegerEntry : map.entrySet()) {
            System.out.println(stringIntegerEntry.getKey());
            System.out.println(stringIntegerEntry.getValue());
        }
        map.forEach((k, v) -> {
            System.out.println(k + " : " + v);
        });*/

        /*Collection<Integer> collection = new ArrayList<>();
        Collection<Integer> collection2 = new ArrayList<>();
        collection.add(1);
        collection.add(3);
        collection.add(2);
        collection2 = collection.stream().sorted((o1, o2) -> o2 - o1).collect(Collectors.toCollection(ArrayList::new));
        System.out.println(collection2);

        Map<String, Integer> map = new HashMap<>();
        map.put("b", 2);
        map.put("c", 3);
        map.put("a", 1);
        Set<Map.Entry<String, Integer>> set = map.entrySet();
        Set<Map.Entry<String, Integer>> set1 = set.stream().sorted((o1, o2) -> o2.getValue() - o1.getValue()).collect(Collectors.toCollection(LinkedHashSet::new));
        System.out.println(set1);*/
        Callable<String> callable = new MyCallable(10);
        FutureTask<String> futureTask = new FutureTask<>(callable);
        new Thread(futureTask).start();
        System.out.println(futureTask.get());

    }

    /*public static void sss(String name, int... numbers) {
        System.out.println("可变参数测试:" + name);
        for (int number : numbers) {
            System.out.println(number);
        }
    }*/

}
class MyCallable implements Callable<String>{
    private int n;

    public MyCallable(int n) {
        this.n = n;
    }

    @Override
    public String call() {
        StringBuilder a = new StringBuilder();
        for (int i = 0; i < n; i++) {
            a.append("h");
        }
        return a.toString();
    }
}